package com.better.common.utils;


import java.math.BigDecimal;

/**
 * @author  知识点得分率工具类
 * @create 2017-09-23 18:29
 **/
public class PointGetAvgUtil {
    private int count = 0;
    private Double score = new Double(0);

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public Double getScore() {
        return score;
    }

    public void setScore(Double score) {
        this.count++;
        this.score =this.score + score;
    }
    public Double calAvg(){
        BigDecimal sc = new BigDecimal(this.score);
        //计算平均得分率，保留4为小数
        Double re = sc.divide(new BigDecimal(this.count),4,BigDecimal.ROUND_HALF_UP).doubleValue();
        return re;
    }
}
